import { gql } from '@apollo/client';

const USER_FIELDS = `
  name
  age
  gender
  id
  createdAt
`;


const GET_USERS = gql`
  query Users {
    users {
      ${USER_FIELDS}
    }
  }
`

const ADD_USER = gql`
  mutation User ($user: UserBaseFields!) {
    createUser (user: $user) {
      ${USER_FIELDS}
    }
  }
`;

const EDIT_USER = gql`
  mutation User ($id: ID!, $user: UserBaseFields!) {
    updateUser (id: $id, user: $user) {
      ${USER_FIELDS}
    }
  }
`;

const RM_USER = gql`
  mutation User ($id: ID!) {
    deleteUser (id: $id)
  }
`;

export {
  GET_USERS,
  ADD_USER,
  EDIT_USER,
  RM_USER
};
